package com.dream.vo.master;

import java.io.Serializable;
import java.util.Collection;

import org.apache.commons.lang.StringUtils;
import org.hibernate.validator.constraints.NotBlank;

import com.dream.model.master.Shop;
import com.dream.model.master.Shop.ShopType;
import com.dream.vo.base.FirstGroup;
import com.google.common.collect.Lists;

public class ShopVO implements Serializable {

	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1674731958303604140L;

	private String id;
	
	@NotBlank(message = "err0001",groups = {FirstGroup.class})
	private String name;
	
	private String shopType;
	
	private String address;
	
	private String shopPic;
	
	private String contact;
	
	private String comments;
	
	private String firstOrg;
	
	private String secondOrg;
	
	private Collection<Long> orgs = Lists.newArrayList();
	
	private Collection<String> shops = Lists.newArrayList();
	
	private String userId;
	
	private String userName;
	
	public Collection<String> getShops() {
		return shops;
	}

	public void setShops(Collection<String> shops) {
		this.shops = shops;
	}
	
	public String getShopType() {
		return shopType;
	}

	public void setShopType(String shopType) {
		this.shopType = shopType;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public void populate(Shop shop){
		
		if(shop == null){return ;}
		
		shop.setName(name);
		if(StringUtils.isNotBlank(secondOrg)){
			shop.setOrgId(Long.parseLong(secondOrg));
		}
		
		shop.setAddress(address);
		shop.setShopPic(shopPic);
		shop.setContact(contact);
		shop.setComments(comments);
		shop.setShopType(ShopType.getInstance(shopType));
		
	}


	public String getId() {
		return id;
	}


	public void setId(String id) {
		this.id = id;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getAddress() {
		return address;
	}


	public void setAddress(String address) {
		this.address = address;
	}


	public String getShopPic() {
		return shopPic;
	}


	public void setShopPic(String shopPic) {
		this.shopPic = shopPic;
	}


	public String getContact() {
		return contact;
	}


	public void setContact(String contact) {
		this.contact = contact;
	}


	public String getComments() {
		return comments;
	}


	public void setComments(String comments) {
		this.comments = comments;
	}


	public String getFirstOrg() {
		return firstOrg;
	}


	public void setFirstOrg(String firstOrg) {
		this.firstOrg = firstOrg;
	}


	public String getSecondOrg() {
		return secondOrg;
	}


	public void setSecondOrg(String secondOrg) {
		this.secondOrg = secondOrg;
	}


	public Collection<Long> getOrgs() {
		return orgs;
	}


	public void setOrgs(Collection<Long> orgs) {
		this.orgs = orgs;
	}
	
	
	
}
